﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace MemoryGames.Helpers
{
	/// <summary>
	/// Provides methods to log errors, warnings and other messages
	/// </summary>
	class Logging
	{
		/// <summary>
		/// Logs the given exception to file
		/// </summary>
		/// <param name="ex"></param>
		public static void LogException(Exception ex)
		{
			// Write exception information to file
			File.AppendAllText(string.Format("log_{0}.txt", DateTime.Now.ToString("yyyyMMdd")), string.Format("{0} - {1}: {2}{3}", DateTime.Now.ToString("dd-MM-yyyy HH:mm"), ex.Message, ex.StackTrace, Environment.NewLine));
		}
	}
}
